<!DOCTYPE html>
<html lang="en">

<head>
  <meta charset="UTF-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
  <style>
    .parent {
      width: 500px;
      height: 500px;
      background-color: pink;
    }

    .son {
      width: 200px;
      height: 200px;
      background-color: green;
    }
  </style>
</head>

<body>
  <div id="app">
    =={{msg}}
    <hr />
    <!-- 解决冒泡 -->
    <!-- <div class="parent" @click.self="parent">
      parent
      <div class="son" @click="son">
        son
      </div>
    </div> -->
    <div class="parent" @click="parent">
      parent
      <div class="son" @click="son">
        son
        <a @click.stop.prevent href="https://www.baidu.com">跳转</a>
      </div>
    </div>

    <a @click.prevent href="https://www.baidu.com">跳转</a>
    <a @click.prevent="handle" href="https://www.baidu.com">跳转</a>
  </div>
  <script src="https://cdn.bootcdn.net/ajax/libs/vue/2.7.14/vue.min.js"></script>
  <script>
    var vm = new Vue({
      el: "#app",
      data: {
        msg: 'hello  vue'
      },
      methods: {
        parent () {
          console.log('parent');
        },
        son () {
          console.log('son');
        },
        handle () {
          console.log('prevent');
        }
      }
    })

    // console.log(vm, 2222);
  </script>
</body>

</html>